#ifndef PID_CONTROLLER_H
#define PID_CONTROLLER_H

class PidController {
public:
    PidController(float kp = 0.0f, float ki = 0.0f, float kd = 0.0f);

    void setTunings(float kp, float ki, float kd);
    void setOutputLimits(float min, float max);
    void reset();  // 重置误差积累项

    float compute(float target, float measurement);

private:
    float _kp, _ki, _kd;
    float _integral;
    float _previousError;

    float _outputMin;
    float _outputMax;
};

#endif // PID_CONTROLLER_H
